# 连接数据库
import mysql.connector
from charset_normalizer.md__mypyc import exports
from flask import current_app


def get_connent():
    try:
        conn = mysql.connector.connect(
            host=current_app.config.get('DB_HOST', 'localhost'),
            user=current_app.config.get('DB_USER', 'root'),
            password=current_app.config.get('DB_PASSWORD', 'root'),
            database=current_app.config.get('DB_NAME', 'online_sea'),
            port=current_app.config.get('DB_PORT', 3306)
            # host='localhost',
            # user='root',
            # password='root',
            # database='online_sea',
            # port=3306
        )
    except mysql.connector.Error as err:
        print("连接数据库报错了：",err)
    return conn


